package com.vanke.devops.api.controller;

import com.vanke.devops.api.base.BaseController;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @author 陈景阳
 * @since 2018/1/9
 */
@RestController
@RequestMapping("/api")
public class IndexController extends BaseController{

    @Value("${spring.profiles.active}")
    private String env;

    @GetMapping
    public String index(){
        return "<h1>this is " + env + " vontainer api</h1>";
    }

    @PostMapping("/sshj")
    public String sshj(HttpServletRequest request){
        /*String json = null;
        try {
            json = IOUtils.toString(request.getInputStream(),"utf-8");
            System.err.println(json);
        } catch (IOException e) {
            e.printStackTrace();
        }*/
        return "";
    }
}
